Chart for WPF and Silverlight > Chart Features > Axis > Tick Marks > Specifying the Major and Minor Ticks in Code |
There are two types of ticks on the axis: major tick has a small line and corresponding label while the minor tick has only the line across the axis.
By default, the distance between ticks is calculated automatically.
To set a specific distance, use the MajorUnit and MinorUnit properties.
Default Ticks
The following image displays the default ticks:
Custom Ticks
The following chart image uses the MajorUnit and MinorUnit properties to set the specific distance, for example:
Visual Basic |
Copy Code
|
---|---|
c1Chart1.View.AxisY.MajorUnit = 5 c1Chart1.View.AxisY.MinorUnit = 1 |
C# |
Copy Code
|
---|---|
c1Chart1.View.AxisY.MajorUnit = 5; c1Chart1.View.AxisY.MinorUnit = 1; |
Time Axis
For time axis you can specify the MajorUnit and MinorUnit as a TimeSpan value:
Visual Basic |
Copy Code
|
---|---|
c1Chart1.View.AxisY.MajorUnit = TimeSpan.FromHours(12) |
C# |
Copy Code
|
---|---|
c1Chart1.View.AxisY.MajorUnit = TimeSpan.FromHours(12); |